#ifndef _P_H_
#define _P_H_

#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<string.h>
#include<strings.h>
#include<sqlite3.h>
#include<fcntl.h>
#include<sys/types.h>
#include<arpa/inet.h>
#include<unistd.h>
#include<sys/stat.h>
#define N 20
typedef struct usermsg
{
	int userID;
	char username[N];
	char pwd[N];
}Usermsg;
typedef struct mymod
{
	int modid;
	char modname[N];
	char property[N];
}Mymod;
sqlite3 *sql_Open(const char * dbname);
int mylogin(int newfd,sqlite3 *mydb,char *tbname,char*buflogin);
int db_zsgc(sqlite3 *mydb,int newfd);
int create_mytb(sqlite3* mydb,const char *tbname);
int create_tb(sqlite3* mydb,const char *tbname);
int insert_db(sqlite3 *mydb,const char *tbname ,Usermsg data);
int insert_mydb(sqlite3 *mydb,const char *tbname ,Mymod newmod);
int callback(void * prama,int f_num,char * f_value[],char * f_name[]);
int select_db(sqlite3 * mydb,const char * tbname);
int tcp_newcom(int newfd,sqlite3 *mydb,char *tbname);
int myregister(int newfd,sqlite3 *mydb,char *tbname,char *buf);
int tcp_server(const char*ip,int port);
int select_mydb( int newfd,sqlite3 * mydb,const char * tbname ,int id,char *pwd);
int parsestr2(char *buflogin,char *id,char *pwd);
int myinsert(int newfd,sqlite3 *mydb,char *tbname,char *buf);
int tcp_com(int newfd);
int delete_db(sqlite3 * mydb,const char * tbname);
int parsestr1(char *buf,char* id,char *usrname,char *pwd);
int parseStr(char *buf,char *cmd,char * filename);
int do_work(int newfd,char *cmd,char *filename);
int s_Upload(int newfd,char *filename);
int s_Download(int newfd,char* filename);
int select_db1(sqlite3 * mydb,const char * tbname);

#endif
